package com.ruoyi.otc.service.impl;

import java.util.Arrays;
import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;//导包
import com.ruoyi.otc.mapper.BusinessMapper;
import com.ruoyi.otc.domain.Business;
import com.ruoyi.otc.service.IBusinessService;
import com.ruoyi.common.core.text.Convert;

/**
 * 企业信息Service业务层处理
 *
 * @author gjp
 * @date 2023-10-26
 */
@Service
public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> implements IBusinessService
{
    @Autowired
    private BusinessMapper businessMapper;

    /**
     * 查询企业信息
     *
     * @param id 企业信息主键
     * @return 企业信息
     */
    @Override
    public Business selectBusinessById(Long id)
    {
        return businessMapper.selectById(id);
    }

    /**
     * 查询企业信息列表
     *
     * @param business 企业信息
     * @return 企业信息
     */
    @Override
    public List<Business> selectBusinessList(Business business)
    {
        return businessMapper.selectList(new QueryWrapper<>(business));
    }

    /**
     * 新增企业信息
     *
     * @param business 企业信息
     * @return 结果
     */
    @Override
    public int insertBusiness(Business business)
    {
                business.setCreateTime(DateUtils.getNowDate());
            return businessMapper.insert(business);
    }

    /**
     * 修改企业信息
     *
     * @param business 企业信息
     * @return 结果
     */
    @Override
    public int updateBusiness(Business business)
    {
                business.setUpdateTime(DateUtils.getNowDate());
        return businessMapper.updateById(business);
    }

    /**
     * 批量删除企业信息
     *
     * @param ids 需要删除的企业信息主键
     * @return 结果
     */
    @Override
    public int deleteBusinessByIds(String ids)
    {
        return businessMapper.deleteBatchIds(Arrays.asList(Convert.toStrArray(ids)));
    }

    /**
     * 删除企业信息信息
     *
     * @param id 企业信息主键
     * @return 结果
     */
    @Override
    public int deleteBusinessById(Long id)
    {
        return businessMapper.deleteById(id);
    }

    @Override
    public  List<String> selectenttypeCn(){
        return businessMapper.selectenttypeCn();
    }
}
